# -*- coding: utf-8 -*-

import imp
import unittest

files = [
    'login.py',
    'me.py',
    'user.py',
    'session.py',
    'corp.py',
    'corp_user.py',
    'device.py',
    'corp_device.py',
    'user_device.py',
    'device_package_record.py',

    'my_corp.py',
    'my_corp_user.py',
    'my_device.py',
    'my_corp_user_device.py',

    'system.py',
    'admin_template.py',

    'rest_order.py',

    'action_log.py',
    'my_action_log.py',

    'filter_error.py',

    'analytics_fact.py',
    'analytics_metric.py',
    'analytics_calculate_metric.py',
    'analytics_dimension.py',
    'analytics_fact_resource.py',
    'analytics_query.py',

    'data.py',
    'rule.py',
    'tool.py',
]

Suite = unittest.TestSuite()
for f in files:
    print 'loading [%s]' % f
    m = imp.load_source('m', f)
    Suite.addTest(m.Suite)

def confirm():
    from base import CONF
    for k in ['host', 'port', 'username', 'password']:
        print k + ': ' + CONF.get('test', k)

    return raw_input('Confirm? [y/n]')


if __name__ == '__main__':
    if confirm() == 'y':
        unittest.TextTestRunner().run(Suite)


